<?php
namespace App\Listener;

use Hyperf\Event\Contract\ListenerInterface;
use Hyperf\Event\Annotation\Listener;

use App\Repository\UserIntegralRepository;

/**
 * @Listener 
 */
class UserIntegralListener implements ListenerInterface
{
    public function listen(): array
    {
        return [
            \App\Event\UserPay\StatusOkEvent::class,
            \App\Event\User\MoneyIntegralEvent::class
        ];
    }
    
    // 创建远程日志
    public function process($event)
    {
        UserIntegralRepository::make()->create($event->user, [
           'phone'      => $event->user->phone,
           'integral'   => $event->money,
           'body'       => '准备请求'
        ]);
    }
}